/* 用户名校验*/
export function isValidUsername(str) {
  const usernameRegex = /^[A-Za-z0-9]{5,16}$/
  return usernameRegex.test(str)
}

/* 真实姓名校验*/
export function isValidRealName(str) {
  const realnameRegex = /^[\u4e00-\u9faf]+$/
  return realnameRegex.test(str)
}

/* 密码校验*/
export function isValidPassword(str) {
  const pwdRegex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,14}$/
  return pwdRegex.test(str)
}

/* 合法uri*/
export function isValidURL(textval) {
  const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
  return urlregex.test(textval)
}

/* 小写字母*/
export function isValidLowerCase(str) {
  const reg = /^[a-z]+$/
  return reg.test(str)
}

/* 大写字母*/
export function isValidUpperCase(str) {
  const reg = /^[A-Z]+$/
  return reg.test(str)
}

/* 大小写字母*/
export function validAlphabets(str) {
  const reg = /^[A-Za-z]+$/
  return reg.test(str)
}

/* 手机号码校验*/
export function isValidPhone(str) {
  const phoneReg = /^1\d{10}$/
  return phoneReg.test(str)
}

/* 邮箱校验*/
export function isValidEmail(str) {
  const emailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
  return emailReg.test(str)
}

/* 角色名称校验*/
export function isValidRolename(str) {
  const roleNameRegex = /^[\u4e00-\u9faf]+$/
  return roleNameRegex.test(str)
}

/* 角色编码校验*/
export function isValidRoleCode(str) {
  const roleCodeRegex = /^[A-Za-z0-9]{3,16}$/
  return roleCodeRegex.test(str)
}

export function isValidAuthorityName(str) {
  const authorityNameRegex = /^[\u4e00-\u9faf]+$/
  return authorityNameRegex.test(str)
}

export function isValidAuthorityCode(str) {
  const authorityCodeRegex = /^[A-Za-z0-9]{3,16}$/
  return authorityCodeRegex.test(str)
}

export function isValidMenuName(str) {
  const menuNameRegex = /^[\u4e00-\u9faf]+$/
  return menuNameRegex.test(str)
}

export function isValidMenuCode(str) {
  const menuCodeRegex = /^[A-Za-z0-9]{3,16}$/
  return menuCodeRegex.test(str)
}




